<template>
  <div class="order-header">
    <div class="container clearfix">
      <div class="header-logo">
        <a href="/"></a>
      </div>
      <div class="title">
        <h2>{{ title }}
          <slot name="tip"></slot>
        </h2>
      </div>
      <div class="username">
        <a href="javascript:">{{ username }}</a>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState} from "vuex";

export default {
  name: "orderHeader",
  props: {
    title: String,
  },
  computed: {
    ...mapState(['username'])
  },
}
</script>

<style scoped lang="scss">

@import "~@/assets/scss/mixin.scss";

.order-header {
  padding: 30px 0;
  border-bottom: 2px solid #FF6600;

  .container {
    .header-logo {
      float: left;
      display: inline-block;
      width: 55px;
      height: 55px;
      background-color: #FF6600;

      a {
        display: inline-block;
        width: 110px;
        height: 55px;

        &:before {
          content: ' '; /*很重要!!!,占位用*/
          @include bgImg(55px, 55px, "/imgs/mi-logo.png", 55px);
          /*display: inline-block;
          width: 55px;
          height: 55px;
          background: url("/imgs/mi-logo.png") no-repeat center;
          background-size: 55px;*/
          transition: margin .2s;
        }

        &:after {
          content: ' '; /*很重要*/
          @include bgImg(55px, 55px, "/imgs/mi-home.png", 55px);

          /*display: inline-block;
          width: 55px;
          height: 55px;
          background: url("/imgs/mi-home.png") no-repeat center;
          background-size: 55px;*/
        }

        &:hover:before { /*修改before*/
          margin-left: -55px;
          transition: margin .2s;
        }
      }
    }

    .title, .username {
      display: inline-block;
      height: 55px;
      line-height: 55px;
    }

    .title {
      font-size: 28px;
      float: left;
      color: #333333;
      margin-left: 54px;

      h2 {
        font-size: 28px;
        color: #333333;
      }

      span {
        font-size: 14px;
        margin-left: 17px;
        color: #999999;
        font-weight: 200;
      }
    }

    .username {
      float: right;

      a {
        color: #666666;
        font-size: 16px;
      }
    }
  }
}
</style>
